Skip to content

AbstractItemDelegateMixin

Sub classes

Name Children Inherits
AbstractItemDelegate
prettyqt.widgets.abstractitemdelegate
Used to display and edit data items from a model.
    ItemDelegate
    prettyqt.widgets.itemdelegate
    Display and editing facilities for data items from a model.
      StyledItemDelegate
      prettyqt.widgets.styleditemdelegate

      Base classes

      Name Children Inherits
      ObjectMixin
      prettyqt.core.object
      object
      builtins
      The base class of the class hierarchy.
      • type
      • async_generator
      • bytearray_iterator
      • bytearray
      • bytes_iterator
      • bytes
      • builtin_function_or_method
      • callable_iterator
      • PyCapsule
      • cell
      • classmethod_descriptor
      • ...

        ⋔ Inheritance diagram

        graph TD
          3153451512["widgets.AbstractItemDelegateMixin"]
          3227531497["core.ObjectMixin"]
          2751680898["builtins.object"]
          3227531497 --> 3153451512
          2751680898 --> 3227531497
          2751680898 --> 3153451512

        🛈 DocStrings

        Bases: ObjectMixin, _AbstractItemDelegateBase

        Source code in prettyqt/widgets/abstractitemdelegate.py
        class AbstractItemDelegateMixin(core.ObjectMixin, _AbstractItemDelegateBase):
            # this pattern doesnt work for PySide6 yet (cant pass kwargs for class definition)
            # _registry = {}
        
            # def __init_subclass__(cls, identifier=None, **kwargs):
            #     super().__init_subclass__(**kwargs)
            #     if identifier is not None:
            #         logger.debug(f"registering delegate {cls} {identifier!r}")
            #         if (
            #             identifier in cls._registry
            #             and cls._registry[identifier].__name__ != cls.__name__
            #         ):
            #             raise NameError(f"Delegate with id {identifier!r} already registered.")
            #         cls._registry[identifier] = cls
        
            @staticmethod
            def _data_for_index(
                index: core.ModelIndex, role: constants.ItemDataRole = constants.USER_ROLE
            ):
                # using index.data() sometimes casts stuff in PyQt6
                model = index.model()
                return model.data(index, role)
        

        :fa-brands-github: Show source on GitHub